package gold.digger;

import gold.utils.InputUtil;

import java.util.*;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC1748 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int sumOfUnique(int[] nums) {
            Map<Integer, Integer> cnt = new HashMap<Integer, Integer>();
            for (int num : nums) {
                cnt.put(num, cnt.getOrDefault(num, 0) + 1);
            }
            int ans = 0;
            for (Map.Entry<Integer, Integer> entry : cnt.entrySet()) {
                int num = entry.getKey(), c = entry.getValue();
                if (c == 1) {
                    ans += num;
                }
            }
            return ans;
        }
    }


    public void run() {
        Solution solution = new Solution();
        int[] arr = InputUtil.toIntegerArray("[1,2,3]");
        System.out.println(solution.toString());
    }

    public static void main(String[] args) throws Exception {
        LC1748 an = new LC1748();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
